using System.Runtime.Serialization;
using System.Text.Json.Serialization;

namespace AI.Model.Json.Chat;

/// <summary>
/// Chat completion request message model.
/// </summary>
[DataContract]
public class ChatMessage
{
    /// <summary>
    /// The role of the messages author. One of system, user, assistant, or function.
    /// </summary>
    [DataMember(Name = "role")]
    [JsonPropertyName("role")]
    public string? Role { get; set; }

    /// <summary>
    /// The contents of the message. content is required for all messages, and may be null for assistant messages with function calls.
    /// </summary>
    [DataMember(Name = "content")]
    [JsonPropertyName("content")]
    public string? Content { get; set; }

    /// <summary>
    /// The name of the author of this message. name is required if role is function, and it should be the name of the function whose response is in the content. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of 64 characters.
    /// </summary>
    [DataMember(Name = "name")]
    [JsonPropertyName("name")]
    public string? Name { get; set; }

    /// <summary>
    /// The name and arguments of a function that should be called, as generated by the model.
    /// </summary>
    [DataMember(Name = "function_call")]
    [JsonPropertyName("function_call")]
    public ChatMessageFunctionCall? FunctionCall { get; set; }
}
